<?php

namespace app\admin\controller;

use think\Db;

class Config extends Authorized
{

    public function index()
    {
        $post_data = $this->request->post();
        if($post_data){
            $result =Db::table('config')->where('id',1)->setField($post_data);
            if (false === $result) {
                return json(['msg' =>'失败', 'code' =>1]);
            } else {
                return json(['msg' =>'成功', 'code' =>0]);
            }
        }

        $article=Db::table('config')->where('id' ,1)->find();
        $this->assign('article', $article);
//        print_r($article);
//        return 1;
        return $this->fetch();
    }


}